package com.blb.zycommunity.service.impl;

import com.blb.zycommunity.entity.SysDictData;
import com.blb.zycommunity.mapper.SysDictDataMapper;
import com.blb.zycommunity.service.ISysDictDataService;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cache.annotation.Cacheable;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;

/**
 * <p>
 * 字典数据表 服务实现类
 * </p>
 *
 * @author chenheng
 * @since 2023-11-20
 */
@Service
public class SysDictDataServiceImpl extends ServiceImpl<SysDictDataMapper, SysDictData> implements ISysDictDataService {

    @Resource
    private SysDictDataMapper sysDictDataMapper;

    @Cacheable(cacheNames = "SysDictDataLabel", key = "T(String).valueOf(#dictType)")
    @Override
    public List<SysDictData> findDictData(String dictType) {
        List<SysDictData> sysDictDataList = sysDictDataMapper.selectDictDataLabel(dictType);
        return sysDictDataList;
    }
}
